<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      "use strict";
      /* 
      1. 返回一个新函数，复制函数
      2. 复制函数的同时绑定参数值
      */
      function fn(x, y) {
        console.log("hello fn", this, x, y);
      }
      const fn1 = fn.bind({ a: 1 });
      const fn2 = fn.bind({ a: 1 }, 100);
      const fn3 = fn.bind({ a: 1 }, 100, 300);
      fn(1, 2);
      fn1(3, 4);
      fn2(200);
      fn3();
    </script>
  </body>
</html>
